import request from '@/utils/request'

// 对应接口的列表接口index
export function fetchDictList(query) {
  return request({
    url: '/dict/list',
    method: 'get',
    params: query
  })
}

// 对应接口的详情接口show
export function fetchDict(id) {
  return request({
    url: `/dict/${id}`,
    method: 'get',
    params: {}
  })
}

// 对应接口的创建接口post create
export function createDict(data) {
  return request({
    url: '/dict.json',
    method: 'post',
    data
  })
}

// 对应接口的更新接口put update
export function updateDict(id, data) {
  return request({
    url: `/dict/${id}.json`,
    method: 'put',
    data
  })
}

// 对应接口的更新接口delete
export function deleteDict(id) {
  return request({
    url: `/dict/${id}.json`,
    method: 'delete',
    params: {}
  })
}
